package com.woniuxy.springparking.service.Impl;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.woniuxy.springparking.common.RestResult;
import com.woniuxy.springparking.dao.MerchantUsersDao;
import com.woniuxy.springparking.pojo.MerchantUsers;
import com.woniuxy.springparking.service.MerchentUserService;
import com.woniuxy.springparking.vo.MerchentUserVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class MerchentUserServiceImpl implements MerchentUserService {
    @Autowired
    private MerchantUsersDao merchantUsersDao;
    @Override
    public RestResult findByPage(MerchentUserVo mvo) {
        Page<Object> pages=PageHelper.startPage(mvo.getPage(),mvo.getLimit());
        List<MerchantUsers> data=this.merchantUsersDao.selectMUserByPage(mvo);
        return new RestResult(pages.getTotal(),data);
    }

    @Override
    public RestResult findCheckByPage(MerchentUserVo mvo) {
        Page<Object> pages=PageHelper.startPage(mvo.getPage(),mvo.getLimit());
        List<MerchantUsers> data=this.merchantUsersDao.selectMUserCheckByPage(mvo);
        return new RestResult(pages.getTotal(),data);
    }

    @Override
    public void updateState(Integer state,Integer id) {
        this.merchantUsersDao.updateState(state,id);
    }

    @Override
    public void updateMState(String m_state, Integer id) {
        this.merchantUsersDao.updateMState(m_state,id);
    }
}
